package stateKit;

public enum StateTimeInterval {
    Minute(1, 60 * 1000L),
    Hour(2, 60 * 60 * 1000L),
    Day(3, 24 * 60 * 60 * 1000L);

    private int id;
    private long intervalMs;

    StateTimeInterval(int id, long intervalMs) {
        this.id = id;
        this.intervalMs = intervalMs;
    }

    public static StateTimeInterval getById(int id) {
        for (StateTimeInterval t : StateTimeInterval.values()) {
            if (t.getId() == id) {
                return t;
            }
        }
        throw new RuntimeException("统计时间间隔枚举不存在！");
    }

    public long getIntervalMs() {
        return intervalMs;
    }

    public int getId() {
        return id;
    }
}